package sigmacinema.entity;

import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cascade;

@Entity
@Table(name="user")
public class User {
    
    @Id
    @Column(name="username", length=50, nullable=false)
    private String username;

    @Column(name="password", length=50, nullable=false)
    private String password;

    @Column(name="enabled", nullable=false,columnDefinition="tinyint")
    private Integer enabled;

    @OneToOne(mappedBy = "user",cascade= CascadeType.ALL)
    private Customer customer;

    @OneToMany(mappedBy= "user")
    @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
    private List<Authorities> auth;

    public List<Authorities> getAuth() {
        return auth;
    }

    public void setAuth(List<Authorities> auth) {
        this.auth = auth;
    }
                
    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

}
